
#include "threadsaver.h"
#include "components/thread.h"

namespace Wishmaster
{
	ThreadSaver::ThreadSaver()
	{
	}

	ThreadSaver::~ThreadSaver()
	{
	}

	void ThreadSaver::save(ThreadPtr thread, const QString& path, ThreadBuilderPtr builder)
	{
		builder->start(thread->getName());
//		for(Thread::postIterator it = thread->visiblePosts()->begin();
//				it != thread->visiblePosts()->end(); ++it)
		for(int postNumber = 0; postNumber < thread->getActualPostsCount(); postNumber++)
		{
			builder->emitPost(thread->getPost(postNumber));
		}
		builder->end();
		builder->save(path);
	}
}

